package com.jadesoft.stock.rp;

import java.util.Date;
import java.util.List;

import org.springframework.util.Assert;

import com.jadesoft.common.web.AjaxAction;
import com.jadesoft.stock.WeatherSubBS;
import com.jadesoft.stock.WeatherSubBSImpl;
import com.jadesoft.stock.entity.WeatherSubscript;

public class WeatherSubAction extends AjaxAction {
	private WeatherSubBS subBs = new WeatherSubBSImpl();

	public WeatherSubscript save(WeatherSubscript sub){
		sub.setUserId(this.getUser().getId());
		sub.setUpdateTime(new Date());
		return subBs.save(sub);
	}
	
	public void remove(WeatherSubscript sub){
		Assert.notNull(sub.getId(),"ID不能为空!");
		sub.setUserId(getUser().getId());
		subBs.remove(sub);
	}
	
	public List<WeatherSubscript> list(){
		WeatherSubscript sub = new WeatherSubscript();
		sub.setUserId(getUser().getId());
		return subBs.list(sub);
	}

}
